package com.kunbo.cn.app.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kunbo.cn.service.core.inventory.InventoryService;
import com.kunbo.cn.util.retu.BuildBean;
import com.kunbo.cn.util.retu.ResultBean;

@RestController
@RequestMapping("/inventory")
public class InventoryAppController {
	
	@Autowired
	private InventoryService service;
	
	/**
	 * 老板APP 消息 （类型的库存量）
	 * @return
	 */
	@PostMapping("/inventoryCount")
	public ResultBean<List<Map<String,Object>>> inventoryCount(){
		ResultBean<List<Map<String,Object>>> result = new ResultBean<List<Map<String,Object>>>();
		return BuildBean.buildResult(result, "success", "error", service.inventoryCount());
	}
	
	
	/**
	 * 获取不同物料类型的list
	 * @param code
	 * @param materialType
	 * @param page
	 * @param pageSize
	 * @return
	 */
	@PostMapping("/showMaterTypeMes")
	public ResultBean<List<Map<String,Object>>> showMaterTypeMes(
			@RequestParam("code")String code,
			@RequestParam("materialType")String materialType,
			@RequestParam("page")Integer page,
			@RequestParam("pageSize")Integer pageSize
			){
		ResultBean<List<Map<String,Object>>> result = new ResultBean<List<Map<String,Object>>>();
		return BuildBean.buildResult(result, "success", "error", service.showMaterTypeMes(code,materialType,page,pageSize));
	}

}
